﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using SCS.Web.UI.WebControls;

public partial class ServerApiSample : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);

        Toolbar1.ButtonCssClasses.CssClass = "button";
        Toolbar1.ButtonCssClasses.CssClassEnabled = "button_enabled";
        Toolbar1.ButtonCssClasses.CssClassDisabled = "button_disabled";
        Toolbar1.ButtonCssClasses.CssClassSelected = "button_selected";

        if (!Page.IsPostBack)
        {
            Toolbar1.Items.Add(CreateButton("New", "New"));
            Toolbar1.Items.Add(CreateButton("Save", "Save"));
            Toolbar1.Items.Add(CreateButton("Delete", "Delete"));
        }
    }

    private ToolbarButton CreateButton(string text, string commandName)
    {
        ToolbarButton button = new ToolbarButton();

        button.Text = text;        
        button.CommandName = commandName;

        return button;
    }

    public void Toolbar1_ButtonClicked(object sender, ButtonEventArgs e)
    {
        ButtonClickedText.Text = "Item Selected: " + e.SourceButton.Text;
    }
}
